package itext;

import com.itextpdf.text.pdf.BaseFont;
import com.lowagie.text.rtf.style.RtfFont;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.awt.*;

/**
 * Created by Administrator on 2017/8/8.
 */
public class ItextFont {

    public static Logger log = LoggerFactory.getLogger(ItextFont.class);
    public static RtfFont fangZhengDoc18 = null;
    public static RtfFont fangSongBoldDoc12 = null;
    public static RtfFont fangSongNormalDoc12 = null;
    public static RtfFont fangSongBoldDoc10 = null;
    public static RtfFont fangSongNormalDoc10 = null;
    public static com.itextpdf.text.Font fangZhengPdf18 = null;
    public static com.itextpdf.text.Font fangSongBoldPdf12 = null;
    public static com.itextpdf.text.Font fangSongNormalPdf12 = null;
    public static com.itextpdf.text.Font fangSongBoldPdf10 = null;
    public static com.itextpdf.text.Font fangSongNormalPdf10 = null;
    public static com.itextpdf.text.Font fuhaoPdf10 = null;

    static {
        fangZhengDoc18 = new RtfFont("方 正 小 标 宋 简 体", 18, com.lowagie.text.Font.NORMAL, Color.BLACK);
        fangSongBoldDoc12 = new RtfFont("仿 宋", 12F, com.lowagie.text.Font.BOLD, Color.BLACK);
        fangSongNormalDoc12 = new RtfFont("仿 宋", 12F, com.lowagie.text.Font.NORMAL, Color.BLACK);
        fangSongBoldDoc10 = new RtfFont("仿 宋", 11F, com.lowagie.text.Font.BOLD, Color.BLACK);
        fangSongNormalDoc10 = new RtfFont("仿 宋", 11F, com.lowagie.text.Font.NORMAL, Color.BLACK);
        String rootPath = ItextFont.class.getResource("/").getPath();
        try {
            BaseFont simfang = BaseFont.createFont(rootPath + "font/simfang.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
            BaseFont FZXBSJW = BaseFont.createFont(rootPath + "font/FZXBSJW.TTF", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
            BaseFont msmincho = BaseFont.createFont(rootPath + "font/msmincho.ttc,0", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
            fangZhengPdf18 = new com.itextpdf.text.Font(FZXBSJW, 18, com.itextpdf.text.Font.NORMAL);
            fangSongBoldPdf12 = new com.itextpdf.text.Font(simfang, 12f, com.itextpdf.text.Font.BOLD);
            fangSongNormalPdf12 = new com.itextpdf.text.Font(simfang, 12f, com.itextpdf.text.Font.NORMAL);
            fangSongBoldPdf10 = new com.itextpdf.text.Font(simfang, 11f, com.itextpdf.text.Font.BOLD);
            fangSongNormalPdf10 = new com.itextpdf.text.Font(simfang, 11f, com.itextpdf.text.Font.NORMAL);
            fuhaoPdf10 = new com.itextpdf.text.Font(msmincho, 11f, com.itextpdf.text.Font.NORMAL);
        } catch (Exception e) {
            log.error("【Manual】=> itext 字体加载异常 {}", e.getMessage());
        }

    }


}
